import { Token } from '@/types/data'
import { RootAction } from '@/types/store'
import { getToken } from '@/utils/token'

const initValue: Token = getToken()

export function loginReducer(state = initValue, action: RootAction) {
  // action处理。。。
  // { type: 'login/login', payload: res.data.data }
  if (action.type === 'login/login') {
    return action.payload
  }

  return state
}
